﻿using CleanArchitecture.Core.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping
{
    /// <summary>
    /// Represents a user mapping configuration
    /// </summary>
    public partial class SystemLogMap : NowaEntityTypeConfiguration<SystemLogEntity>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<SystemLogEntity> builder)
        {
            builder.ToTable("sys_log");
            builder.HasKey(log => log.Id);

            builder.Property(log => log.LogLevel).HasMaxLength(20);
            //builder.Property(log => log.LogMessage).HasMaxLength(1000);
            builder.Property(log => log.IpAddress).HasMaxLength(50);
            builder.Property(user => user.PageUrl).HasMaxLength(500);

            base.Configure(builder);
        }

        #endregion
    }
}